﻿Public Class frmDisAdd

    'Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    '    Me.flexResult.Rows.Count = AermodProject0.Aermod.Receptor.DiscCarts.Length + 1
    '    Me.flexResult.Cols.Count = 1
    '    Me.flexResult.Cols(0).Caption = "关心点"
    '    Dim SelectedGroupCount As Integer = 0
    '    For i As Integer = 0 To AermodProject0.Aermod.Source.Groups.ArrayGroup.Length - 1
    '        If Me.flexAdd.Item(i + 1, "Selected") = True Then
    '            Me.flexResult.Cols.Count += 1
    '            Me.flexResult.Cols(Me.flexResult.Cols.Count - 1).Caption = AermodProject0.Aermod.Source.Groups.ArrayGroup(i).Name
    '            SelectedGroupCount += 1
    '        End If
    '    Next
    '    Me.flexResult.Cols.Count += 1
    '    Me.flexResult.Cols(Me.flexResult.Cols.Count - 1).Caption = "叠加结果"
    '    Me.flexResult.Cols.Count += 1
    '    Me.flexResult.Cols(Me.flexResult.Cols.Count - 1).Caption = "出现时刻"

    '    For i As Integer = 0 To AermodProject0.Aermod.Receptor.DiscCarts.Length - 1
    '        Me.flexResult.Item(i + 1, 0) = AermodProject0.Aermod.Receptor.DiscCarts(i).Name
    '    Next
    '    Me.flexResult.AutoSizeCols()
    '    '用于储存各关心点各组源的最大结果
    '    Dim MaxData(AermodProject0.Aermod.Receptor.DiscCarts.Length - 1, SelectedGroupCount) As Double
    '    Dim MaxTime(AermodProject0.Aermod.Receptor.DiscCarts.Length - 1) As String
    '    With AermodProject0.Aermod
    '        Dim PrjPath As String = My.Computer.FileSystem.GetFileInfo(AermodProject0.SaveName).DirectoryName
    '        Dim strNameLast As String = CAermod.GetFileName(AermodProject0.SaveName)
    '        Dim PostPath As String = PrjPath & "\" & strNameLast & "\"
    '        Dim nCount As Integer = 0
    '        '先找出总的数据记录的个数
    '        For i As Integer = 0 To AermodProject0.Aermod.Source.Groups.ArrayGroup.Length - 1
    '            If Me.flexAdd.Item(i + 1, "Selected") = True Then '如果组被选中，则读取该组的数据
    '                Dim strName As String = PostPath & "Aermod\" & .Control.AllPolluts.AllSelectPollut(Me.cmbPollution.SelectedIndex).Name & "_" & .Source.Groups.ArrayGroup(i).Name & "_POST_" & Me.cmbTime.Text & ".BIN"
    '                If My.Computer.FileSystem.FileExists(strName) Then
    '                    Dim Post As New CAermod.PostResult
    '                    nCount = Post.GetDataCount(.Control, .Receptor, .Control.AllPolluts.AllSelectPollut(Me.cmbPollution.SelectedIndex).Dispersion.DEPOS, strName, AermodProject0.Aermod.AermodVersion)
    '                    If nCount > 0 Then
    '                        Exit For
    '                    End If
    '                End If
    '            End If
    '        Next

    '        '按每一个记录开始进行比较，并按关心点找出叠加的最大值和对应的日期
    '        For nIndex As Integer = 0 To nCount - 1
    '            Dim AllGroupPostBin(SelectedGroupCount - 1) As CAermod.PostFineBinResult
    '            For iIntial As Integer = 0 To SelectedGroupCount - 1
    '                AllGroupPostBin(iIntial) = New CAermod.PostFineBinResult
    '            Next
    '            Dim iSelected As Integer = 0
    '            For i As Integer = 0 To AermodProject0.Aermod.Source.Groups.ArrayGroup.Length - 1
    '                Dim Post As New CAermod.PostResult
    '                If Me.flexAdd.Item(i + 1, "Selected") = True Then '如果组被选中，则读取该组的数据
    '                    Dim strName As String = PostPath & "Aermod\" & .Control.AllPolluts.AllSelectPollut(Me.cmbPollution.SelectedIndex).Name & "_" & .Source.Groups.ArrayGroup(i).Name & "_POST_" & Me.cmbTime.Text & ".BIN"
    '                    If Me.flexAdd.Item(i + 1, "Selected") = True Then '如果组被选中，则读取该组的数据
    '                        Dim OnePostBin As CAermod.PostFineBinResult = Post.GetDataPostBin(.Control, .Receptor, .Control.AllPolluts.AllSelectPollut(Me.cmbPollution.SelectedIndex).Dispersion.DEPOS, nIndex, strName, "09292")
    '                        AllGroupPostBin(iSelected) = OnePostBin
    '                        If Me.flexAdd.Item(i + 1, "Type") = "-" Then
    '                            For nCare As Integer = 0 To AllGroupPostBin(iSelected).m_CareData.Length - 1
    '                                AllGroupPostBin(iSelected).m_CareData(nCare).con = 0 - AllGroupPostBin(iSelected).m_CareData(nCare).con
    '                            Next
    '                        End If
    '                        iSelected += 1
    '                    End If
    '                End If
    '            Next
    '            Dim CountCare(.Receptor.DiscCarts.Length - 1) As Double '各关心点的和
    '            For iCare As Integer = 0 To .Receptor.DiscCarts.Length - 1
    '                For nGoup As Integer = 0 To AllGroupPostBin.Length - 1
    '                    CountCare(iCare) += AllGroupPostBin(nGoup).m_CareData(iCare).con
    '                Next
    '            Next
    '            For iCare As Integer = 0 To .Receptor.DiscCarts.Length - 1
    '                If MaxData(iCare, SelectedGroupCount) < CountCare(iCare) Then
    '                    MaxData(iCare, SelectedGroupCount) = CountCare(iCare)
    '                    For nGoup As Integer = 0 To AllGroupPostBin.Length - 1
    '                        MaxData(iCare, nGoup) = AllGroupPostBin(nGoup).m_CareData(iCare).con
    '                    Next
    '                    If AllGroupPostBin.Length > 0 Then
    '                        MaxTime(iCare) = AllGroupPostBin(0).m_dateD
    '                    End If
    '                End If
    '            Next
    '        Next
    '        For iRow As Integer = 0 To .Receptor.DiscCarts.Length - 1
    '            For iCol As Integer = 0 To SelectedGroupCount
    '                Me.flexResult.Item(iRow + 1, iCol + 1) = FormatNumber(MaxData(iRow, iCol) / 1000, Me.cmbNumber.SelectedIndex)
    '            Next
    '            Me.flexResult.Item(iRow + 1, SelectedGroupCount + 2) = MaxTime(iRow)
    '        Next
    '    End With
    'End Sub

    Private Sub frmDisAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.flexAdd.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.flexResult.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.flexResult.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        Me.cmbNumber.SelectedIndex = 4

        Me.flexAdd.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.flexAdd.AllowResizing = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.flexAdd.AllowSorting = C1.Win.C1FlexGrid.AllowDraggingEnum.None

        Me.flexResult.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.flexResult.AllowResizing = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.flexResult.AllowSorting = C1.Win.C1FlexGrid.AllowDraggingEnum.None
    End Sub
End Class